package cn.neusoft.yuejian307.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.squareup.picasso.Picasso;

import cn.neusoft.yuejian307.R;

public class ActivityDetail extends AppCompatActivity {
private TextView t1,t2,t3,t4,t5,t6,t7,t8;
    private ImageView pic;
    private Intent intent;
    private Bundle bundle;
    private int id;
    MyTitle myTitle;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_detail);
        intent = getIntent();
        bundle = intent.getExtras();
        init();
    }
    private void init(){
        myTitle = (MyTitle)findViewById(R.id.tt);
        myTitle.setTitle("活动详情");
        id = bundle.getInt("acid");
        pic = (ImageView)findViewById(R.id.activity_picture) ;
        Picasso.with(ActivityDetail.this).load(bundle.getString("pic")).into(pic);
        t1 = (TextView)findViewById(R.id.address);
        t1.setText(bundle.getString("address"));
        t2 = (TextView)findViewById(R.id.time);
        t2.setText(bundle.getString("name"));
        t3 = (TextView)findViewById(R.id.phone);
        t3.setText(bundle.getString("phone"));
        t4 = (TextView)findViewById(R.id.intro);
        t4.setText(bundle.getString("intro"));
        t5 = (TextView)findViewById(R.id.number);
        t5.setText(bundle.getString("number"));
        t6 = (TextView)findViewById(R.id.end_time);
        t6.setText(bundle.getString("endtime"));
        t7 = (TextView)findViewById(R.id.price);
        t7.setText(bundle.getString("price"));
        t8 = (TextView)findViewById(R.id.trianApply);
        t8.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(ActivityDetail.this,ApplyActivity.class);
                intent.putExtra("id",id+"");
                intent.putExtra("1",bundle.getString("name"));
                intent.putExtra("2",bundle.getString("price"));
                intent.putExtra("3",bundle.getString("phone"));
                intent.putExtra("4",bundle.getString("intro"));
                intent.putExtra("5",bundle.getString("pic"));
                startActivity(intent);
            }
        });

    }
}
